package com.yixun.qfbao.weappmessage;

public class WeAppMessageConstant {
    /**
     * 接口调用凭证
     */
    public static final String ACCESS_TOKEN = "access_token";
    /**
     * 接收者（用户）的 openid
     */
    public static final String TO_USER = "touser";
    /**
     * 所需下发的模板消息的id
     */
    public static final String TEMPLATE_ID = "template_id";
    /**
     * 点击模板卡片后的跳转页面，仅限本小程序内的页面。支持带参数,（示例index?foo=bar）。该字段不填则模板无跳转。
     */
    public static final String PAGE = "page";
    /**
     * 表单提交场景下，为 submit 事件带上的 formId；支付场景下，为本次支付的 prepay_id
     */
    public static final String FORM_ID = "form_id";
    /**
     * 模板内容，不填则下发空模板
     */
    public static final String DATA = "data";
    /**
     * 模板需要放大的关键词，不填则默认无放大
     */
    public static final String EMPHASIS_KEYWORD = "emphasis_keyword";

    /**
     * ACCESS_TOKEN失效
     */
    public static final int TOKEN_INVALID = 40001;

    /**
     * FORM_ID不正确
     */
    public static final int FORM_ID_INVALID = 41028;

    /**
     * FOMR_ID被使用
     */
    public static final int FORM_ID_BE_USED = 41029;

    /**
     * 聊天页面
     */
    public static final String PAGE_CHAT = "pages/chat/chat?formMessage=true&userId=";

    /**
     * 名片被收藏页面
     */
    public static final String PAGE_CARD_COLLECT = "pages/card/radarDetail?type=todayCollect&formMessage=true&cardId=";

    /**
     * 名片被转发页面
     */
    public static final String PAGE_CARD_SHARE = "pages/card/radarDetail?type=todayShare&formMessage=true&cardId=";

    /**
     * 房源被转发页面
     */
    public static final String PAGE_HOUSE_SHARE = "pages/product/houseOpRecordDetail?formMessage=true&type=todayShare&logicId=";

    /**
     * 房源列表页
     */
    public static final String PAGE_HOUSE_LIST = "pages/home/index?logicId=";

    public static String getPathByType(int type) {
        if (WeAppMessageTypeEnum.TYPE_1.getCode() == type ) {
            return PAGE_CHAT;
        } else if (WeAppMessageTypeEnum.TYPE_2.getCode() == type) {
            return PAGE_CARD_SHARE;
        } else if (WeAppMessageTypeEnum.TYPE_3.getCode() == type) {
            return PAGE_CARD_COLLECT;
        } else if (WeAppMessageTypeEnum.TYPE_4.getCode() == type) {
            return PAGE_HOUSE_SHARE;
        } else {
            return PAGE_HOUSE_LIST;
        }
    }
}
